package com.mars.foodserver.controller.app;

import com.mars.foodserver.request.FoodTypeRequest;
import com.mars.foodserver.response.result.R;
import com.mars.foodserver.service.IFoodTypeService;
import org.springframework.web.bind.annotation.*;
import lombok.AllArgsConstructor;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wq
 * @since 2021-07-19
 */
@RestController
@RequestMapping("/foodType")
@AllArgsConstructor
public class FoodTypeController {

    final IFoodTypeService foodTypeService;

    /**
     * 分页
     *
     * @param request 请求参数
     * @return R
     */
    @PostMapping("/page")
    private R page(@RequestBody FoodTypeRequest request) {
        return R.success(foodTypeService.page(request));
    }


    /**
     * 首页菜系列表
     *
     * @return R
     */
    @GetMapping("/list")
    public R foodTypeList() {
        return R.success(foodTypeService.foodTypeList());
    }


    /**
     * 详情菜系
     *
     * @param id ID
     * @return R
     */
    @GetMapping("/detail")
    public R detail(Integer id) {
        return R.success(foodTypeService.detailFoodType(id));
    }


}
